<?php
/* @var $this SiteController */
$this->pageTitle = Yii::app()->name;
//Total de contactos
$contactosCount = Contacto::model()->getCountContactos();
?>

<!--<h1>Bienvenido al Demo de <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>-->

<div class="metro-nav">
    <div class="metro-nav-block nav-block-grey">
        <a href="<?php echo Yii::app()->createUrl('/cruge/ui/usermanagementadmin') ?>" data-original-title="">
            <i class="icon-lock"></i>
            <div class="info"><?php echo count(Yii::app()->user->um->listUsers()) ?></div>
            <div class="status">Usuarios</div>
        </a>
    </div>
    <div class="metro-nav-block nav-block-orange double">
        <a href="<?php echo Yii::app()->createUrl('/crm/cuenta/admin') ?>" data-original-title="">
            <i class="icon-suitcase"></i>
            <div class="info"><?php echo Cuenta::model()->activos()->count() ?></div>
            <div class="status">Cuentas</div>
        </a>
    </div>

    <div class="metro-nav-block nav-block-green">
        <a href="<?php echo Yii::app()->createUrl('/crm/contacto/admin') ?>" data-original-title="">
            <i class="icon-group"></i>
            <div class="info"><?php echo Contacto::model()->activos()->count() ?></div>
            <div class="status">Contactos</div>
        </a>
    </div>
    <div class="metro-nav-block nav-block-blue">
        <a href="<?php echo Yii::app()->createUrl('/oportunidades/oportunidad/admin') ?>" data-original-title="">
            <i class="icon-tags"></i>
            <div class="info">
                $<?php
                $oportunidadTotal = Oportunidad::model()->activos()->sumaMonto()->probabilidadValida()->findAll();
                echo $oportunidadTotal ? $oportunidadTotal[0]['suma_monto'] : '0';
                ?></div>
            <div class="status">Oportunidades</div>
        </a>
    </div>
    <div class="metro-nav-block nav-block-yellow">
        <a href="<?php echo Yii::app()->createUrl('/cobranzas/cobranza/admin') ?>" data-original-title="">
            <i class="icon-money"></i>
            <div class="info">
                $<?php
                $cobranzaTotal = Cobranza::model()->activos()->sumaMontoMora()->porcentajeValido()->findAll();
                echo $cobranzaTotal ? number_format($cobranzaTotal[0]['cuota_vencida'],2) : '0';
                ?>
            </div>
            <div class="status">Cobranzas</div>
        </a>
    </div>
</div>
<div class="metro-nav">
    <div class="metro-nav-block nav-block-purple double">
        <a href="<?php echo Yii::app()->createUrl('/incidencias/incidencia/admin') ?>" data-original-title="">
            <i class="icon-fire-extinguisher"></i>
            <div class="info"><?php echo Incidencia::model()->activos()->porcentajeValido()->count() ?></div>
            <div class="status">Incidencias</div>
        </a>
    </div>
    <div class="metro-nav-block nav-block-redblack">
        <a href="<?php echo Yii::app()->createUrl('/eventos/calendario/index') ?>" data-original-title="">
            <i class="icon-calendar"></i>
            <div class="info"><?php echo Evento::model()->activos()->fechaReferencia()->count() ?></div>
            <div class="status">Eventos</div>
        </a>
    </div>
    <div class="metro-nav-block nav-block-red">
        <a href="<?php echo Yii::app()->createUrl('/tareas/tarea/admin') ?>" data-original-title="">
            <i class="icon-tasks"></i>
            <div class="info"><?php echo Tarea::model()->activos()->noConcluidas()->count() ?></div>
            <div class="status">Tareas</div>
        </a>
    </div>
</div>

<div class="row-fluid">
    <div class="span7">
        <?php Util::checkAccess(array("action_tarea_admin")) ? $this->renderPartial('portlets/_tareas') : ''; ?>
        <?php $this->renderPartial('portlets/_incidenciaReporte') ?>
        <?php $this->renderPartial('portlets/_sessionReporte') ?>
    </div>
    <div class="span5">

        <?php $this->renderPartial('portlets/_oportunidadEtapaReporte') ?>
        <?php $this->renderPartial('portlets/_oportunidadReporte') ?>
        <?php $this->renderPartial('portlets/_cobranzaReporte') ?>
    </div>
</div>



